package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type AppConfig struct {
	Mysql
}
type Mysql struct {
	Host     string `yaml:"host"`
	Post     int    `yaml:"post"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Dbname   string `yaml:"dbname"`
}

var AppConf AppConfig

func Init() {
	viper.SetConfigFile("appconfig/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic(err)
	}
	err = viper.Unmarshal(&AppConf)
	if err != nil {
		panic(err)
	}
	fmt.Println("配置没有加载成功：", AppConf)

}
